package me.kafeitu.activiti.chapter10.listeners;

import java.util.List;

import org.activiti.engine.EngineServices;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.task.Task;


public class MultiTaskEnd implements ExecutionListener{

    private static final long serialVersionUID = 1L;

    @Override
    public void notify(DelegateExecution execution) throws Exception{
        EngineServices engineServices = execution.getEngineServices();
        List<Task> tasks = engineServices.getTaskService().createTaskQuery().processInstanceId( execution.getProcessInstanceId()).list();
       
        for (Task task:tasks) {
            System.out.println("Task=" + task);
        }
        System.out.println("===task ended===");
    }

}
